feat(connectors): add OAuth connector resource schemas and file parsing#189
feat(connectors): add OAuth connector resource schemas and file parsing#189Paveltarno wants to merge 3 commits intomainfrom
Conversation
🚀 Package Preview Available!Install this PR's preview build with npm: npm i @base44-preview/cli@0.0.28-pr.189.322a27aPrefer not to change any import paths? Install using npm alias so your code still imports npm i "base44@npm:@base44-preview/cli@0.0.28-pr.189.322a27a"Or add it to your {
"dependencies": {
"base44": "npm:@base44-preview/cli@0.0.28-pr.189.322a27a"
}
}
Preview published to npm registry — try new features instantly! |
Add connector resource module supporting 12 OAuth providers: googlecalendar, googledrive, gmail, googlesheets, googledocs, googleslides, slack, notion, salesforce, hubspot, linkedin, tiktok. - Zod discriminated union schema with type discriminator per provider - JSDoc links to official OAuth scope documentation for each provider - JSONC file reading with validation (filename must match type field) - API response schemas for upstream connector state - Unit tests with fixtures for valid, invalid, and mismatched connectors Part of: #184 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add API client methods for OAuth connector operations: - listConnectors: list all connectors for current app - syncConnector: sync connector with exact scope matching - getOAuthStatus: poll OAuth authorization status - removeConnector: remove a connector integration Also update response schemas and clean up verbose comments. Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
* feat(connectors): implement push logic for syncing connectors Add pushConnectors function that: - Syncs all local connectors via /sync endpoint - Removes upstream-only connectors not in local config - Returns typed results (synced, removed, needs_oauth, error) Includes unit tests covering all scenarios. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat(connectors): add OAuth flow handling with browser redirect and polling (#192) * feat(connectors): add OAuth flow handling with browser redirect and polling Add runOAuthFlow function that: - Opens OAuth redirect URL in browser - Polls getOAuthStatus until ACTIVE or FAILED - Returns PENDING on timeout (5 minutes) Uses p-wait-for TimeoutError for robust timeout detection. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * connectors: base44 connectors push (#194) * final connector work sofi 1 * scopes --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
c3543de to
c1bb2d1
Compare
Code ReviewI found 4 issues that need to be addressed: 1. 🔴 Case mismatch in
|
Note
Description
This PR adds comprehensive OAuth connector support to the Base44 CLI, enabling users to manage OAuth integrations (Google services, Slack, Notion, etc.) through
connectors/*.jsoncfiles. It implements the complete connector lifecycle including file parsing with Zod validation, API client for CRUD operations, OAuth authorization flow with browser redirect and polling, and abase44 connectors pushcommand that syncs connectors and handles interactive authorization.Related Issue
Closes #184
Type of Change
Changes Made
src/core/resources/connector/schema.ts): Defined Zod schemas for 12 OAuth providers (googlecalendar, googledrive, gmail, googlesheets, googledocs, googleslides, slack, notion, salesforce, hubspot, linkedin, tiktok) with discriminated union, JSDoc links to official OAuth documentation, and comprehensive API response schemasconfig.ts): ImplementedreadAllConnectors()with validation rules enforcing filename-type matching, duplicate detection, and graceful handling of missing directoriesapi.ts): Added four connector management functions:listConnectors(),setConnector()(sync),getOAuthStatus()(poll), andremoveConnector()push.ts): CreatedpushConnectors()that syncs local connectors and removes upstream-only connectors, returning detailed results per connectoroauth.ts): ImplementedrunOAuthFlow()that opens browser, polls status with 5-minute timeout using p-wait-for, and returns final statussrc/cli/commands/connectors/push.ts): Addedbase44 connectors pushwith interactive OAuth authorization, summary reporting, and CI mode supportProjectDatatype, and updated program to include connectors commandTesting
npm test)Checklist
Additional Notes
This implementation follows the established Resource pattern used for entities and functions. The OAuth flow includes intelligent handling of edge cases:
The connector resource integrates seamlessly with existing project management (
readProjectConfig) and follows all architectural patterns from CLAUDE.md including error handling, structured errors, API client patterns, and dependency injection via CLIContext.Note: Typecheck CI is currently failing - needs investigation before merge.
🤖 Generated by Claude | 2026-02-08 23:47 UTC